package cn.iocoder.yudao.module.shop.dal.mysql.refundcardrecord;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.refundcardrecord.ShopRefundCardRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.refundcardrecord.vo.*;

/**
 * 退卡记录 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopRefundCardRecordMapper extends BaseMapperX<ShopRefundCardRecordDO> {

    default PageResult<ShopRefundCardRecordDO> selectPage(ShopRefundCardRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopRefundCardRecordDO>()
                .eqIfPresent(ShopRefundCardRecordDO::getLeftBalance, reqVO.getLeftBalance())
                .eqIfPresent(ShopRefundCardRecordDO::getRefundBalance, reqVO.getRefundBalance())
                .eqIfPresent(ShopRefundCardRecordDO::getComment, reqVO.getComment())
                .betweenIfPresent(ShopRefundCardRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopRefundCardRecordDO::getId));
    }

    default List<ShopRefundCardRecordDO> selectList(ShopRefundCardRecordExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopRefundCardRecordDO>()
                .eqIfPresent(ShopRefundCardRecordDO::getLeftBalance, reqVO.getLeftBalance())
                .eqIfPresent(ShopRefundCardRecordDO::getRefundBalance, reqVO.getRefundBalance())
                .eqIfPresent(ShopRefundCardRecordDO::getComment, reqVO.getComment())
                .betweenIfPresent(ShopRefundCardRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopRefundCardRecordDO::getId));
    }

}
